package top.usts.springframework.context.support;

import top.usts.springframework.beans.factory.support.DefaultListableBeanFactory;
import top.usts.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * @description:
 * @author: CJ
 * @date: 2022/2/23
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext{

    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[]  configLocations = getConfigLocations();
        if (configLocations != null) {
            beanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    protected abstract String[] getConfigLocations();
}
